/*
 * Copyright (C) 2020 The YouTike.com Authors.
 * http://www.youtike.com
 */

package com.qdxwx.models.enums;

/**
 * @author ZhiYong
 * @dateTime 2020/11/13
 */
public enum ApprovalStatus {
    REJECTED(-1, "被退回"),
    WAITING(0, "待审核"),
    PASSED(1, "已通过");

    private final String name;
    private final int value;

    /**
     * @param name  名称
     * @param value 值
     */
    ApprovalStatus(int value, String name) {
        this.name = name;
        this.value = value;
    }

    public int getValue() {
        return this.value;
    }

    public String getName() {
        return this.name;
    }

    public static ApprovalStatus getStatus(int value) {
        for (ApprovalStatus status : ApprovalStatus.values()) {
            if (status.getValue() == value) {
                return status;
            }
        }
        return WAITING;
    }

    @Override
    public String toString() {
        return "ApprovalStatus{" +
                "name='" + name + '\'' +
                ", value=" + value +
                '}';
    }
}
